package cn.bestick.cblog.service.impl;

import java.util.List;

import cn.bestick.cblog.dao.FriendLinkDao;
import cn.bestick.cblog.dao.impl.FriendLinkDaoImpl;
import cn.bestick.cblog.dmo.FriendLink;
import cn.bestick.cblog.service.FriendLinkService;

public class FriendLinkServiceImpl implements FriendLinkService {
	private FriendLinkDao friendLinkDao;

	public FriendLinkServiceImpl() {
		this.friendLinkDao = new FriendLinkDaoImpl();
	}

	@Override
	public List<FriendLink> getFriendLinks() {
		List<FriendLink> friendLinks = null;
		try {
			friendLinks = friendLinkDao.all();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return friendLinks;
	}

	@Override
	public void updateFriendLink(FriendLink friendLink) {
		try {
			this.friendLinkDao.update(friendLink);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Override
	public void saveFriendlink(FriendLink friendLink) {
		try {
			this.friendLinkDao.save(friendLink);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Override
	public void deleteFriendLink(Integer id) {
		try {
			this.friendLinkDao.delete(id);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Override
	public FriendLink getFriendLink(int id) {
		FriendLink friendLink = null;
		try {
			friendLink = friendLinkDao.get(id);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return friendLink;
	}
}
